package edu.c06190115.cardiac;
 
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
 
public class Education extends Activity implements OnItemClickListener {
 
        private ListView theList;
        private String fileName;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_education);
                Intent intent = this.getIntent();
        		fileName = intent.getStringExtra("edu.c06190115.cardiac.file_name");
                theList = (ListView)findViewById(R.id.the_list);
                theList.setOnItemClickListener(this);
        }
 
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
                // Inflate the menu; this adds items to the action bar if it is present.
                getMenuInflater().inflate(R.menu.education, menu);
                return true;
        }
       
        public boolean onOptionsItemSelected(MenuItem item) {
                switch (item.getItemId()) {
                case R.id.startMain:
                	finish();
                        return true;
                }
                return false;
        }
 
        public void onItemClick(AdapterView<?> parent,View view,int position,
                        long rowId) {
                String algorithmName = (String) theList.getItemAtPosition(position);
                Intent nextActivity = new Intent();
                nextActivity.setClassName("edu.c06190115.cardiac","edu.c06190115.cardiac.SetAlgorithm");
                nextActivity.putExtra("edu.c06190115.cardiac.algorithm_name", algorithmName);
                nextActivity.putExtra("edu.c06190115.cardiac.file_name", fileName);
                finish();
                startActivity(nextActivity);
        }
 
}